import { AxiosPromise } from 'axios'
import request from '@/hooks/utils/http'

export class SysDicttaService {
  /**
   * 删除数据集定义
   */
  static del = (ids: Array<string | number> | string | number) => {
    return request({
      url: '/sys/dict/data/' + ids,
      method: 'delete'
    })
  }
  /**
   * 新增数据集定义
   */
  static add = (data: any) => {
    return request({
      url: '/sys/dict/data',
      method: 'post',
      data: data
    })
  }
  /**
   * 修改数据集定义
   * @param data
   */
  static update = (data: any) => {
    return request({
      url: '/sys/dict/data',
      method: 'put',
      data: data
    })
  }
  /**
   * 查询数据集定义详细
   */
  static get = (id: string | number): AxiosPromise<SysDicttaVO> => {
    return request({
      url: '/sys/dict/data/' + id,
      method: 'get'
    })
  }
  /**
   * 获取数据集定义列表
   */
  static list = (query: SysDicttaQuery): AxiosPromise<SysDicttaVO[]> => {
    return request({
      url: '/sys/dict/data/list',
      method: 'get',
      params: query
    })
  }
}

export interface SysDicttaVO extends BaseEntity {
  id: string | number
  sort: integer
  label: string
  value: string
  type: string
  business: string
  css: string
  isDefault: string
}

export interface SysDicttaQuery extends PageQuery {
  sort: integer
  label: string
  value: string
  type: string
  business: string
  css: string
  isDefault: string
}

export interface SysDicttaForm {
  id: string | number
  sort: integer
  label: string
  value: string
  type: string
  business: string
  css: string
  isDefault: string
}
